<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>小程序(H5实现)</title>
		<!-- <script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"> -->
		<script type="text/javascript" src="../uni_webview.js">
		</script>
	</head>
	<body>

		<div>
			内置小程序
		</div>
		<div>
			<button id="sendApp">向App发送消息</button>
			<button id="linkAbout">about</button>
			<button id="otherWebview">无状态webview</button>
		</div>

		<script>
			document.addEventListener('UniAppJSBridgeReady', function() {

				uni.getEnv(function(res) {
					if (res.plus) {
						console.log('当前环境为【5+App】');
					} else if (res.miniprogram) {
						console.log('当前环境为【微信小程序】');
					}
				});

			});
			
			document.getElementById("sendApp").addEventListener("click", function() {
				uni.postMessage({
					data: {
						action: 'main',
						message:'向App发送消息'
					}
				});
			}, true)
			
			document.getElementById("linkAbout").addEventListener("click", function() {
				window.location.href="./about.html"
			}, true)
			
			document.getElementById("otherWebview").addEventListener("click", function() {
				uni.postMessage({
					data: {
						action: 'navigateTo',
						type:'',
						url:'/static/innerHtml/noheader.html',
					}
				});
			}, true)
			
		</script>

	</body>
</html>